from django.contrib import admin
from messageDisplay.models import cInformation, ProductDetail, HardDetail, Advise, BasicSensor, PictureM
# Register your models here.

class cInformationAdmin(admin.ModelAdmin):
    list_per_page = 10 # 指定每页显示的数据
    list_display = ['id','userCategory','userCode','userName','userLawer','userAddr','userTel','userEmail', 'userManager','userPasswd','isDel']
    list_filter = ['userName','userCategory','isDel','userManager']
    search_fields = ['id','userCode','userName','userLawer','userTel','userEmail']




class ProductDetailAdmin(admin.ModelAdmin):
    list_per_page = 10
    list_display = ['id','proName','proCode','proLawer','manEnterprise','transer','transerSensor','superer','supererSnesor','manAddr','manDate','expDate','certificateText','examiner','evaluate','isDel']
    list_filter = ['manEnterprise','proName','isDel','transer']
    search_fields = ['id','proName','proCode','proLawer','manEnterprise','manDate','examiner','certificateText','transer']



class HardDetailAdmin(admin.ModelAdmin):
    list_per_page = 10
    list_display = ['id','hardCode','hardLawer','boardDetail','curState','fixDetail','fixData','netState','isDel']
    list_filter = ['hardLawer','curState','netState']
    search_fields = ['id','hardCode','hardLawer']



class AdviseAdmin(admin.ModelAdmin):
    list_per_page = 10
    list_display = ['id','adName','adDoods','adTel','adMail','adIdCard','adDate','adConsumerText','adSupermaketText','adMangerText','adDealSupermarket','adDealManger','adDealFinish','adReturn','isDel']
    list_filter = ['adDealSupermarket','adDealManger','adDealFinish']
    search_fields  = ['id','adName','adDoods','adTel','adMail','adIdCard','adDate']


class BasicSensorAdamin(admin.ModelAdmin):
    list_per_page = 10
    list_display = ['id','sensorName','sensorHard','sensorState','sensorDate','sensorData','isDel']
    list_filter = ['sensorName','sensorHard','sensorState']
    search_fields = ['id','sensorName','sensorHard','sensorDate','sensorData']


class PictureMAdmin(admin.ModelAdmin):
    list_per_page = 10
    list_display = ['id','pic']
    search_fields = ['id','pic']
    list_filter=['id','pic']


# admin.site.register([cInformation,ProductDetail, HardDetail, Advise, BasicSensor],cInformationAdmin,ProductDetailAdmin,HardDetailAdmin,AdviseAdmin,BasicSensorAdmin)
admin.site.register(cInformation,cInformationAdmin)
admin.site.register(ProductDetail,ProductDetailAdmin)
admin.site.register(HardDetail,HardDetailAdmin)
admin.site.register(Advise,AdviseAdmin)
admin.site.register(BasicSensor,BasicSensorAdamin)
admin.site.register(PictureM,PictureMAdmin)
